package net.pm.core.entities.db;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import net.pm.core.entities.PMCommandEntity;


/**
 * The persistent class for the collarmaterial database table.
 * 领料
 */
@Entity
@Table(name="collarmaterial")
public class Collarmaterial extends PMCommandEntity<Collarmaterial>{
	/**
	 * 
	 */
	private static final long serialVersionUID = 5393341409398005840L;
	private Long id;
	private Date addTime;
	private Boolean isBack;
	private Product product;

    public Collarmaterial() {
    }


	public Collarmaterial(Long id) {
		super();
		this.id = id;
	}


	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(unique=true, nullable=false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}


    @Temporal( TemporalType.TIMESTAMP)
	@Column(nullable=false)
	public Date getAddTime() {
		return this.addTime;
	}

	public void setAddTime(Date addTime) {
		this.addTime = addTime;
	}


	@Column(nullable=false)
	public Boolean getIsBack() {
		return this.isBack;
	}

	public void setIsBack(Boolean isBack) {
		this.isBack = isBack;
	}

	//bi-directional one-to-one association to Product
	@OneToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="ProductId", nullable=false)
	public Product getProduct() {
		return this.product;
	}

	public void setProduct(Product product) {
		this.product = product;
	}
	
	@Override
	public int compareTo(Collarmaterial o) {
		// TODO Auto-generated method stub
		return 0;
	}
	
}